package com.apes.enquiry.product.model;


import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;


/**
 * 类描述：机油扩展表
 *
 * @ClassName OilyExtend
 * @Description 描述
 * @Author lilong
 * @Date 2022/10/31 9:40
 * @Version 1.0
 */


@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = OilyProduct.CONST_TABLE_NAME)
public class OilyProduct extends Model {

    public static final String CONST_TABLE_NAME = "sp_mas_oily_product";

    @Id
    @Column(name = "id", length = 6)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "机油商品")
    @Comment("编码")
    private String id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "sp_id", referencedColumnName = "id")
    @Comment("商品列表")
    private SpProduct spProduct;

    @Column(name = "catena", length = 24)
    @Comment("系列")
    private String catena;

    @Column(name = "model", length = 24)
    @Comment("型号")
    private String model;

    @Column(name = "capacity", length = 24)
    @Comment("容量[L]")
    private Double capacity;//单位：L（升）

    @Column(name = "api_class", length = 24)
    @Comment("API等级")
    private String apiClass;

    @Column(name = "viscosity_class", length = 24)
    @Comment("粘度等级")
    private String viscosityClass;

    @Column(name = "type", length = 24)
    @Comment("类型")
    private String type;

    @Column(name = "engine_oil_type", length = 24)
    @Comment("机油类型")
    private String engineOilType;

}
